<?php

namespace App\Providers;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\Horizon;
use Laravel\Horizon\HorizonApplicationServiceProvider;

class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

         Horizon::routeSmsNotificationsTo('18785573155');
         Horizon::routeMailNotificationsTo('313097973@qq.com');
         Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');

         Horizon::night();
    }

    /**
     * Register the Horizon gate.
     *
     * This gate determines who can access Horizon in non-local environments.
     *
     * @return void
     */
    protected function gate()
    {
        Gate::define('viewHorizon', function ($user) {
            return in_array($user->email, [
                    '313097973@qq.com',
                    '553792575@qq.com',
                ]);//
            // || $user->hasRole('Founder');// 是否是站长
        });
    }
}
